package com.sc.study.ar.service.impl;

import java.util.List;

import com.sc.study.ar.domain.ViolationRegisterQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sc.study.ar.mapper.ScViolationRegisterMapper;
import com.sc.study.ar.domain.ScViolationRegister;
import com.sc.study.ar.service.IScViolationRegisterService;

/**
 * 违纪登记Service业务层处理
 *
 * @author sc
 * @date 2022-03-14
 */
@Service
public class ScViolationRegisterServiceImpl implements IScViolationRegisterService {
    @Autowired
    private ScViolationRegisterMapper scViolationRegisterMapper;

    /**
     * 查询违纪登记
     *
     * @param id 违纪登记主键
     * @return 违纪登记
     */
    @Override
    public ScViolationRegister selectScViolationRegisterById(Long id) {
        return scViolationRegisterMapper.selectScViolationRegisterById(id);
    }

    /**
     * 查询违纪登记列表
     *
     * @param scViolationRegister 违纪登记
     * @return 违纪登记
     */
    @Override
    public List<ScViolationRegister> selectScViolationRegisterList(ScViolationRegister scViolationRegister) {
        return scViolationRegisterMapper.selectScViolationRegisterList(scViolationRegister);
    }

    /**
     * 新增违纪登记
     *
     * @param scViolationRegister 违纪登记
     * @return 结果
     */
    @Override
    public int insertScViolationRegister(ScViolationRegister scViolationRegister) {
        return scViolationRegisterMapper.insertScViolationRegister(scViolationRegister);
    }

    /**
     * 修改违纪登记
     *
     * @param scViolationRegister 违纪登记
     * @return 结果
     */
    @Override
    public int updateScViolationRegister(ScViolationRegister scViolationRegister) {
        return scViolationRegisterMapper.updateScViolationRegister(scViolationRegister);
    }

    /**
     * 批量删除违纪登记
     *
     * @param ids 需要删除的违纪登记主键
     * @return 结果
     */
    @Override
    public int deleteScViolationRegisterByIds(Long[] ids) {
        return scViolationRegisterMapper.deleteScViolationRegisterByIds(ids);
    }

    /**
     * 删除违纪登记信息
     *
     * @param id 违纪登记主键
     * @return 结果
     */
    @Override
    public int deleteScViolationRegisterById(Long id) {
        return scViolationRegisterMapper.deleteScViolationRegisterById(id);
    }

    /**
     * 批量添加
     *
     * @param violationRegisterQuery 参数
     * @return
     */
    @Override
    public boolean batchAdd(ViolationRegisterQuery violationRegisterQuery) {


        return scViolationRegisterMapper.batchAdd(violationRegisterQuery);
    }

    /**
     * 是否登记今日缺勤
     *
     * @param id
     * @return
     */
    @Override
    public boolean isCheckRoom(Long id) {
        return scViolationRegisterMapper.isCheckRoom(id) == 0 ? false : true;
    }
}
